package org.br.erp.base.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.br.erp.base.entity.Scmobject;
import org.br.erp.base.entity.Scmprintdefinition;
import org.br.erp.base.mapper.ScmobjectMapper;
import org.br.erp.base.mapper.ScmprintdefinitionMapper;
import org.br.erp.base.service.IScmprintdefinitionService;
import org.br.erp.base.vo.printformatVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 打印格式定义
 * @Author: jeecg-boot
 * @Date:   2023-01-28
 * @Version: V1.0
 */
@Service
public class ScmprintdefinitionServiceImpl extends ServiceImpl<ScmprintdefinitionMapper, Scmprintdefinition> implements IScmprintdefinitionService {

    @Autowired
    private ScmprintdefinitionMapper scmprintdefinitionMapper;

    @Autowired
    private ScmobjectMapper scmobjectMapper;

    @Override
    public IPage<printformatVo> queryPrintFormatVo(Page<printformatVo> page) {
        MPJLambdaWrapper<Scmprintdefinition> queryWrapper=new MPJLambdaWrapper<Scmprintdefinition>()
                .selectAll(Scmprintdefinition.class)
                .select(Scmobject::getObjectcode,Scmobject::getObjectname)
                .leftJoin(Scmobject.class,Scmobject::getId,Scmprintdefinition::getObjectid);
        IPage<printformatVo> printformatVoIPage = scmprintdefinitionMapper.selectJoinPage(page, printformatVo.class, queryWrapper);
        return printformatVoIPage;
    }
}
